﻿namespace Web
{
    using System;
    using ASP = System.Web.UI.WebControls;
    using Cloudio.Web.UI.Dock;
    using Cloudio.Web.UI.ToolboxItem;
    using Gaia.WebWidgets.Extensions;

    public partial class ToolboxTest : System.Web.UI.Page
    {
        private DockingContainer _toolBox;

        protected void Page_Load(object sender, EventArgs e)
        {
            AddToolbox();
        }

        private void AddToolbox()
        {
            var _toolBoxGaia = new ExtendedPanel
            {
                Caption = "Gaia Ajax 3.6",
                ScrollBars = ASP.ScrollBars.None,
                CssClass = "gaiax"
            };

            foreach (var gaiaToolboxItem in GaiaToolboxItem.GetGaiaToolboxItems())
            {
                var genericToolboxItem = new GenericToolboxItem
                {
                    ID = gaiaToolboxItem.Name,
                    ToolBoxItemType = gaiaToolboxItem.Type,
                    ToolBoxImage = gaiaToolboxItem.ToolboxImage

                };

                _toolBoxGaia.Controls.Add(genericToolboxItem);
            }

            _toolBox = new DockingContainer();
            _toolBox.DockingItems.Add(_toolBoxGaia);

            vport.Controls.AddAt(0, _toolBox);
        }
    }
}
